package component;

public class Connection {
	private final Ball ball;
	private final Tube tube;
	
	public Connection(AbstractComponent a, AbstractComponent b) {
		if (a instanceof Ball && b instanceof Tube) {
			ball = (Ball)a;
			tube = (Tube)b;
		} else if (a instanceof Tube && b instanceof Ball){
			ball = (Ball)b;
			tube = (Tube)a;
		} else
			throw new RuntimeException("Illegal connection.");
	}
	
	public Ball getBall() {
		return ball;
	}
	
	public Tube getTube() {
		return tube;
	}
	
}
